package com.wang.designpattern.command;

public class TVOffCommand implements Command {

    // 聚合TVReceiver
    private TVReceiver receiver;

    public TVOffCommand(TVReceiver receiver) {
        super();
        this.receiver = receiver;
    }

    @Override
    public void execute() {
        // 调用接收者的方法
        receiver.off();
    }

    @Override
    public void undo() {
        // 调用接收者的方法
        receiver.on();
    }
}
